<?php

/**
 * Bug form base class.
 *
 * @method Bug getObject() Returns the current form's model object
 *
 * @package    KC-INDICATEURS
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBugForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'application_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Application'), 'add_empty' => false)),
      'numero_mantis'      => new sfWidgetFormInputText(),
      'severite'           => new sfWidgetFormInputText(),
      'resolution'         => new sfWidgetFormInputText(),
      'statut'             => new sfWidgetFormInputText(),
      'categorie'          => new sfWidgetFormInputText(),
      'resume'             => new sfWidgetFormInputText(),
      'priorite'           => new sfWidgetFormInputText(),
      'regression'         => new sfWidgetFormInputText(),
      'non_corrige'        => new sfWidgetFormInputText(),
      'portee'             => new sfWidgetFormInputText(),
      'version_resolution' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'application_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Application'))),
      'numero_mantis'      => new sfValidatorInteger(),
      'severite'           => new sfValidatorInteger(),
      'resolution'         => new sfValidatorInteger(array('required' => false)),
      'statut'             => new sfValidatorInteger(array('required' => false)),
      'categorie'          => new sfValidatorString(array('max_length' => 128, 'required' => false)),
      'resume'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'priorite'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'regression'         => new sfValidatorInteger(array('required' => false)),
      'non_corrige'        => new sfValidatorInteger(array('required' => false)),
      'portee'             => new sfValidatorInteger(array('required' => false)),
      'version_resolution' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bug[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Bug';
  }

}
